package org.esiee.mobiliteam;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class MapMyCalendarActivity extends MapActivity {
    
	private MapView mapView;
	private MapController mc;
	private GeoPoint location;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
       	
		this.mapView =  new MapView(this,this.getResources().getString(R.string.mapskey));
		this.mapView.setClickable(true);
 		this.mc = this.mapView.getController();
 		double latitude = 48.840103 ,longitude =  2.585092;
 		this.location = new GeoPoint((int) (latitude * 1000000.0),(int) (longitude * 1000000.0));
		this.mc.setCenter(this.location);
 		this.mc.setZoom(17);
 		this.mapView.setSatellite(true);
 		this.mapView.invalidate();
 		
 		//////////////
 		Drawable drawable = this.getResources().getDrawable(R.drawable.marker);
 		ListItimizedOverlay itemizedoverlay = new ListItimizedOverlay(drawable);
 		
 		GeoPoint geoPoint = new GeoPoint((int) (latitude * 1000000.0),(int) (longitude * 1000000.0));
 		OverlayItem overlayitem = new OverlayItem(geoPoint, "ESIEE", "Paris");
 		itemizedoverlay.addOverlayItem(overlayitem);
 		List<Overlay> mapOverlays = mapView.getOverlays();
 		itemizedoverlay.addOverlayItem(overlayitem);
 		mapOverlays.add(itemizedoverlay);
 		//////////////
 		mapView.setBuiltInZoomControls(true);
 		//////////////

		this.setContentView(this.mapView);
   	}

	public GeoPoint getLocation() {
		return location;
	}

	public void setLocation(GeoPoint location) {
		this.location = location;
		this.mc.setCenter(this.location);
		this.mapView.invalidate();
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}